Libraries
Load data
file_path_t <- "/Users/juliat/Desktop/bachelor/Final thesis/ccc_cellchat.t.2.rds"
cellchat.t <- readRDS(file_path_t)
file_path_s <- "/Users/juliat/Desktop/bachelor/Final thesis/ccc_cellchat.s.2.rds"
cellchat.s <- readRDS(file_path_s)
Creating dgCMatrix (to avoid turning all data into a matrix, we take ) and merge data
cellchat.t.sC <- subsetCommunication(cellchat.t, thresh=1) # tresh = 1 not to loose data, because it is not possible to compare 13008 and 12058 rows
cellchat.s.sC <- subsetCommunication(cellchat.s, thresh=1)
# merge the two data frames
merged_data <- merge(cellchat.t.sC, cellchat.s.sC,
by = c("source", "target", "ligand", "receptor", "interaction_name",
"interaction_name_2", "pathway_name", "annotation", "evidence"),
all = TRUE)
Replace NA values with 0
merged_data <- merged_data %>%
mutate(
prob.t = ifelse(is.na(prob.x), 0, prob.x),
prob.s = ifelse(is.na(prob.y), 0, prob.y),
pval.t = ifelse(is.na(pval.x), 0, pval.x),
pval.s = ifelse(is.na(pval.y), 0, pval.y)
) %>%
select(-prob.x, -prob.y, -pval.x, -pval.y) # delete columns
Calculating the difference between probabilities tumor - skin
merged_data <- merged_data %>%
mutate(prob.delta = prob.t - prob.s) %>%
arrange(desc(abs(prob.delta)))
Count interactions for skin and tumor (actual numeric difference )
cellchat.t.sC_counts <- cellchat.t.sC %>% group_by(source, target) %>% summarise(count_t = n())
## `summarise()` has grouped output by 'source'. You can override using the
## `.groups` argument.
cellchat.s.sC_counts <- cellchat.s.sC %>% group_by(source, target) %>% summarise(count_s = n())
## `summarise()` has grouped output by 'source'. You can override using the
## `.groups` argument.
# Merge counts
merged_df.interactions <- merge(cellchat.t.sC_counts, cellchat.s.sC_counts, by=c("source", "target"), all = TRUE)
# Replacing NA with 0 in case some interactions are not present in one of the data frames
merged_df.interactions[is.na(merged_df.interactions)] <- 0
# Calculate the difference in counts:
merged_df.interactions$interaction_difference <- merged_df.interactions$count_t - merged_df.interactions$count_s
Heatmap based on counts difference
heatmap_plot <- ggplot(merged_df.interactions, aes(x=target, y=source, fill=interaction_difference)) +
geom_tile() +
theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Difference in Number of Interactions (Tumor - Skin)", x = "target (receptor)", y = "source (ligand)", fill = "Interactions Difference") +
scale_fill_gradient2(name = "Interactions Diff", high = rgb(178/255, 24/255, 43/255), low = rgb(33/255, 102/255, 172/255)) # Diverging color scale
print(heatmap_plot)
Bubble Plot
# netVisual_bubble(cellchat.t, sources.use = 8, targets.use = 8, thresh = 0.05) # Fibroblast_32 to Fibroblast_32
# netVisual_bubble(cellchat.t, sources.use = 9, targets.use = 9, thresh = 0.05) # Fibroblast_36 to Fibroblast_36
# netVisual_bubble(cellchat.t, sources.use = 8, targets.use = 2, thresh = 0.05) # Fibroblast_32 to Endothel
# netVisual_bubble(cellchat.t, sources.use = 3, targets.use = 8, thresh = 0.05) # Endothel_vasc._31 to Fibroblast_32
# netVisual_bubble(cellchat.t, sources.use = 8, targets.use = 13, thresh = 0.05) # Fibroblast_32 to Monocyte
# netVisual_bubble(cellchat.t, sources.use = 6, targets.use = 2, thresh = 0.05) # Fibroblast_20 to Endothel
CELLCHAT tumor pathways
# cellchat.t@netP$pathways
# cellchat.t@meta$DE = factor(cellchat.t@meta$DE, levels = c ("B cell", "Endothel", "Endothel_vasc._31", "Erythrocyte", "Fibroblast_18", "Fibroblast_20", "Fibroblast_25", "Fibroblast_32", "Fibroblast_36", "T gd", "Keratinocyte_26", "Mast_27", "Monocyte", "Monocyte_23", "Neurons_47", "Neutrophil", "NK", "NK T like", "Plasma_15", "Plasma_35", "Plasma_37", "Platelet", "Schwann_43", "T cytotox. CD8", "T fh", "T mem 1", "T mem 2", "T naive CD4", "T reg CD4", "T undef."))
# x <- "COLLAGEN"
# for(x in cellchat.t@netP$pathways){
# p <- plotGeneExpression(cellchat.t, signaling = x)
# ggsave(paste0(x, ".pdf"),plot=p, width=10, height=10)
# }
CELLCHAT skin pathways
# cellchat.s@netP$pathways
# cellchat.s@meta$DE = factor(cellchat.s@meta$DE, levels = c ("B cell", "Endothel", "Endothel_vasc._31", "Erythrocyte", "Fibroblast_18", "Fibroblast_20", "Fibroblast_25", "Fibroblast_32", "Fibroblast_36", "T gd", "Keratinocyte_26", "Mast_27", "Monocyte", "Monocyte_23", "Neurons_47", "Neutrophil", "NK", "NK T like", "Plasma_15", "Plasma_35", "Plasma_37", "Platelet", "Schwann_43", "T cytotox. CD8", "T fh", "T mem 1", "T mem 2", "T naive CD4", "T reg CD4", "T undef."))
# y <- "COLLAGEN"
# for(y in cellchat.s@netP$pathways){
# p <- plotGeneExpression(cellchat.s, signaling = y)
# ggsave(paste0(y, ".pdf"),plot=p, width=10, height=10)
# }
Number of interactions per source cell (ligand) in tumor and skin
df.t <- cellchat.t %>% subsetCommunication(thresh = NA) %>% as_tibble() # creating a tibble
df.s <- cellchat.s %>% subsetCommunication(thresh = NA) %>% as_tibble()
df.t <- cellchat.t %>%
subsetCommunication(thresh = NA) %>%
dplyr::as_tibble() %>%
dplyr::count(source) %>%
dplyr::rename(Number_of_Interactions = n)
df.t$Type <- "Tumor"
df.s <- cellchat.s %>%
subsetCommunication(thresh = NA) %>%
dplyr::as_tibble() %>%
dplyr::count(source) %>%
dplyr::rename(Number_of_Interactions = n)
df.s$Number_of_Interactions <- -df.s$Number_of_Interactions # making counts negative
df.s$Type <- "Skin"
combined_data <- bind_rows(df.t, df.s)
# Plot tumor + skin
combined_plot <- ggplot(combined_data, aes(x = source, y = Number_of_Interactions, fill = Type)) +
geom_bar(stat = "identity", position = "stack") +
labs(title = "Number of interactions per source cell", y = "Number of Interactions", x = "Source Cell") +
scale_fill_manual(values = c("Skin" = rgb(33/255, 102/255, 172/255), "Tumor" = rgb(178/255, 24/255, 43/255))) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1) # hjust = 1 to "press" names to plot
)
print(combined_plot)
There are no T naive CD4 in skin so lets exclude them from analysis
# Define the identifier for naive CD4 T cells
naive_CD4_identifier <- "T naive CD4"
# Filter out interactions involving naive CD4 T cells from the tumor dataset
cellchat.t.sC <- subsetCommunication(cellchat.t, thresh=1) %>%
filter(!(source == naive_CD4_identifier | target == naive_CD4_identifier))
# Filter out interactions involving naive CD4 T cells from the skin dataset
cellchat.s.sC <- subsetCommunication(cellchat.s, thresh=1) %>%
filter(!(source == naive_CD4_identifier | target == naive_CD4_identifier))
# merge the two data frames
merged_data <- merge(cellchat.t.sC, cellchat.s.sC,
by = c("source", "target", "ligand", "receptor", "interaction_name",
"interaction_name_2", "pathway_name", "annotation", "evidence"),
all = TRUE)
Repeat all steps bellow but for data without T naive CD4 Replace NA values with 0
merged_data <- merged_data %>%
mutate(
prob.t = ifelse(is.na(prob.x), 0, prob.x),
prob.s = ifelse(is.na(prob.y), 0, prob.y),
pval.t = ifelse(is.na(pval.x), 0, pval.x),
pval.s = ifelse(is.na(pval.y), 0, pval.y)
) %>%
select(-prob.x, -prob.y, -pval.x, -pval.y)
Calculating the difference between probabilities tumor - skin
merged_data <- merged_data %>%
mutate(prob.delta = prob.t - prob.s) %>%
arrange(desc(abs(prob.delta)))
Count interactions for skin and tumor (actual numeric difference )
cellchat.t.sC_counts <- cellchat.t.sC %>% group_by(source, target) %>% summarise(count_t = n())
## `summarise()` has grouped output by 'source'. You can override using the
## `.groups` argument.
cellchat.s.sC_counts <- cellchat.s.sC %>% group_by(source, target) %>% summarise(count_s = n())
## `summarise()` has grouped output by 'source'. You can override using the
## `.groups` argument.
# Merge counts
merged_df.interactions <- merge(cellchat.t.sC_counts, cellchat.s.sC_counts, by=c("source", "target"), all = TRUE)
# Replacing NA with 0 in case some interactions are not present in one of the data frames
merged_df.interactions[is.na(merged_df.interactions)] <- 0
# Calculate the difference in counts:
merged_df.interactions$interaction_difference <- merged_df.interactions$count_t - merged_df.interactions$count_s
Heatmap based on counts difference
heatmap_plot <- ggplot(merged_df.interactions, aes(x=target, y=source, fill=interaction_difference)) +
geom_tile() +
theme(axis.text.x = element_text(angle = 90)) +
labs(title = "Difference in Number of Interactions (Tumor - Skin)", x = "target (receptor)", y = "source (ligand)", fill = "Interactions Difference") +
scale_fill_gradient2(name = "Interactions Diff", high = rgb(178/255, 24/255, 43/255), low = rgb(33/255, 102/255, 172/255)) # Diverging color scale
print(heatmap_plot)
Number of interactions per source cell (ligand) in tumor and skin
# Count interactions per source for tumor data without T naive CD4
df.t <- merged_data %>%
dplyr::as_tibble() %>%
dplyr::count(source) %>%
dplyr::rename(Number_of_Interactions = n)
df.t$Type <- "Tumor"
# Count interactions per source for skin data without T naive CD4
df.s <- merged_data %>%
dplyr::as_tibble() %>%
dplyr::count(source) %>%
dplyr::rename(Number_of_Interactions = n)
df.s$Number_of_Interactions <- -df.s$Number_of_Interactions # making counts negative
df.s$Type <- "Skin"
# Combine the two datasets
combined_data <- bind_rows(df.t, df.s)
# Plot tumor + skin without T naive CD4
combined_plot <- ggplot(combined_data, aes(x = source, y = Number_of_Interactions, fill = Type)) +
geom_bar(stat = "identity", position = "stack") +
labs(title = "Number of interactions per source cell without T naive CD4", y = "Number of Interactions", x = "Source Cell") +
scale_fill_manual(values = c("Skin" = rgb(33/255, 102/255, 172/255), "Tumor" = rgb(178/255, 24/255, 43/255))) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
print(combined_plot)
Number of interactions per source cell (ligand) in tumor - skin
# Compute interaction counts for each dataset, excluding T naive CD4
df.t <- cellchat.t %>%
subsetCommunication(thresh = NA) %>%
filter(source != naive_CD4_identifier & target != naive_CD4_identifier) %>%
dplyr::as_tibble() %>%
dplyr::count(source) %>%
dplyr::rename(Tumor_Interactions = n)
df.s <- cellchat.s %>% # no need to exclude, since in skin there is nothing
subsetCommunication(thresh = NA) %>%
dplyr::as_tibble() %>%
dplyr::count(source) %>%
dplyr::rename(Skin_Interactions = n)
# Merge datasets by the 'source' (27 levels - celltypes) column
combined_data.diff <- full_join(df.t, df.s, by = "source")
# Remove NA values because T naive CD4 in Skin_Interactions = NA
combined_data.diff$Tumor_Interactions[is.na(combined_data.diff$Tumor_Interactions)] <- 0
combined_data.diff$Skin_Interactions[is.na(combined_data.diff$Skin_Interactions)] <- 0
# Compute the difference for each source: skin - tumor
combined_data.diff$Interaction_Difference <- combined_data.diff$Tumor_Interactions - combined_data.diff$Skin_Interactions
# Display the table (screenshot saved)
print(combined_data.diff, n = 27)# Display the table (screenshot saved)
## # A tibble: 27 × 4
## source Tumor_Interactions Skin_Interactions Interaction_Difference
## <fct> <dbl> <dbl> <dbl>
## 1 B cell 363 456 -93
## 2 Endothel 884 638 246
## 3 Endothel_vasc._31 1071 860 211
## 4 Erythrocyte 88 92 -4
## 5 Fibroblast_18 1152 1100 52
## 6 Fibroblast_20 993 813 180
## 7 Fibroblast_25 551 458 93
## 8 Fibroblast_32 1299 1002 297
## 9 Fibroblast_36 1116 1241 -125
## 10 T gd 260 300 -40
## 11 Keratinocyte_26 551 615 -64
## 12 Mast_27 154 127 27
## 13 Monocyte 451 352 99
## 14 Monocyte_23 276 175 101
## 15 Neurons_47 25 174 -149
## 16 Neutrophil 105 157 -52
## 17 NK 239 346 -107
## 18 NK T like 293 242 51
## 19 Plasma_15 301 329 -28
## 20 Plasma_35 62 165 -103
## 21 Plasma_37 284 313 -29
## 22 Schwann_43 813 803 10
## 23 T cytotox. CD8 266 329 -63
## 24 T fh 536 504 32
## 25 T mem 1 211 266 -55
## 26 T mem 2 250 309 -59
## 27 T reg CD4 230 289 -59
# Plot tumor - skin with colors for positive and negative differences
difference_plot <- ggplot(combined_data.diff, aes(x = source, y = Interaction_Difference,
fill = Interaction_Difference > 0)) + # Moved inside aes()
geom_bar(stat = "identity", position = "dodge") +
scale_fill_manual(values = c("TRUE" = rgb(178/255, 24/255, 43/255), "FALSE" = rgb(33/255, 102/255, 172/255)),
labels = c("TRUE" = "Tumor", "FALSE" = "Skin")) +
theme_minimal() +
labs(title = "Difference in interactions per source cell (Tumor - Skin)",
y = "Difference in Interactions",
x = "Source Cell") +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
difference_plot
Scatter plot source
scatter_plot <- ggplot(combined_data.diff, aes(x = Tumor_Interactions, y = Skin_Interactions, label = source)) +
geom_point(aes(color = source), size = 3) +
geom_text(aes(label = source), size = 3) +
geom_smooth(method = "lm",se = TRUE) +
labs(title = "Number of Interactions per source Cell", x = "Tumor Interactions", y = "Skin Interactions") +
theme(legend.position = "none")+
theme_minimal()
print(scatter_plot)
## `geom_smooth()` using formula = 'y ~ x'
## Warning: The following aesthetics were dropped during statistical transformation: label
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
## the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
## variable into a factor?
Number of interactions per target cell (receptor) in tumor and skin
df.t <- cellchat.t %>%
subsetCommunication(thresh = NA) %>%
filter(source != naive_CD4_identifier & target != naive_CD4_identifier) %>%
dplyr::as_tibble() %>%
dplyr::count(target) %>%
dplyr::rename(Number_of_Interactions = n)
df.t$Type <- "Tumor"
df.s <- cellchat.s %>%
subsetCommunication(thresh = NA) %>%
dplyr::as_tibble() %>%
dplyr::count(target) %>%
dplyr::rename(Number_of_Interactions = n)
df.s$Number_of_Interactions <- -df.s$Number_of_Interactions # making counts negative
df.s$Type <- "Skin"
combined_data <- bind_rows(df.t, df.s)
# Plot tumor + skin
combined_plot <- ggplot(combined_data, aes(x = target, y = Number_of_Interactions, fill = Type)) +
geom_bar(stat = "identity", position = "stack") +
labs(title = "Number of interactions per target cell", y = "Number of Interactions", x = "Target Cell") +
scale_fill_manual(values = c("Skin" = rgb(33/255, 102/255, 172/255), "Tumor" = rgb(178/255, 24/255, 43/255))) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1) # hjust = 1 to "press" names to plot
)
print(combined_plot)
Number of interactions per target cell (receptor) in tumor - skin
# Compute interaction counts for each dataset
df.t <- cellchat.t %>%
subsetCommunication(thresh = NA) %>%
filter(source != naive_CD4_identifier & target != naive_CD4_identifier) %>%
dplyr::as_tibble() %>%
dplyr::count(target) %>%
dplyr::rename(Tumor_Interactions = n)
df.s <- cellchat.s %>%
subsetCommunication(thresh = NA) %>%
dplyr::as_tibble() %>%
dplyr::count(target) %>%
dplyr::rename(Skin_Interactions = n)
# Merge datasets by the 'target' (27 levels - celltypes) column
combined_data.diff <- full_join(df.t, df.s, by = "target")
# Remove NA values because T naive CD4 in Skin_Interactions = NA
combined_data.diff$Tumor_Interactions[is.na(combined_data.diff$Tumor_Interactions)] <- 0
combined_data.diff$Skin_Interactions[is.na(combined_data.diff$Skin_Interactions)] <- 0
# Compute the difference for each target: tumor - skin
combined_data.diff$Interaction_Difference <- combined_data.diff$Tumor_Interactions - combined_data.diff$Skin_Interactions
print (combined_data.diff, n = 27) # Display the table (screenshot saved)
## # A tibble: 26 × 4
## target Tumor_Interactions Skin_Interactions Interaction_Difference
## <fct> <dbl> <dbl> <dbl>
## 1 B cell 293 333 -40
## 2 Endothel 581 291 290
## 3 Endothel_vasc._31 915 929 -14
## 4 Fibroblast_18 764 659 105
## 5 Fibroblast_20 561 428 133
## 6 Fibroblast_25 188 152 36
## 7 Fibroblast_32 852 575 277
## 8 Fibroblast_36 709 976 -267
## 9 T gd 324 505 -181
## 10 Keratinocyte_26 611 705 -94
## 11 Mast_27 300 183 117
## 12 Monocyte 827 569 258
## 13 Monocyte_23 193 196 -3
## 14 Neurons_47 25 162 -137
## 15 Neutrophil 275 257 18
## 16 NK 539 691 -152
## 17 NK T like 235 282 -47
## 18 Plasma_15 511 542 -31
## 19 Plasma_35 283 168 115
## 20 Plasma_37 492 535 -43
## 21 Schwann_43 686 595 91
## 22 T cytotox. CD8 596 588 8
## 23 T fh 748 867 -119
## 24 T mem 1 416 339 77
## 25 T mem 2 442 448 -6
## 26 T reg CD4 458 480 -22
# Plot tumor - skin with colors for positive and negative differences
difference_plot <- ggplot(combined_data.diff, aes(x = target, y = Interaction_Difference, fill = Interaction_Difference > 0)) + # Moved inside aes()
geom_bar(stat = "identity", position = "dodge") +
scale_fill_manual(values = c("TRUE" = rgb(178/255, 24/255, 43/255), "FALSE" = rgb(33/255, 102/255, 172/255)),
labels = c("TRUE" = "Tumor", "FALSE" = "Skin")) +
theme_minimal() +
labs(title = "Difference in interactions per target cell (Tumor - Skin)",
y = "Difference in Interactions",
x = "Target Cell") +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
difference_plot
Scatter plot target
scatter_plot <- ggplot(combined_data.diff, aes(x = Tumor_Interactions, y = Skin_Interactions, label = target)) +
geom_point(aes(color = target), size = 3) +
geom_text(aes(label = target), size = 3) +
geom_smooth(method = "lm",se = TRUE) +
labs(title = "Number of Interactions per target Cell", x = "Tumor Interactions", y = "Skin Interactions") +
theme(legend.position = "none")+
theme_minimal()
print(scatter_plot)
## `geom_smooth()` using formula = 'y ~ x'
## Warning: The following aesthetics were dropped during statistical transformation: label
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
## the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
## variable into a factor?
Plotting top 10 interactions with biggest differences in tumor - skin
# Combining data tumor and skin
df.t <- cellchat.t %>%
subsetCommunication(thresh = NA) %>%
filter(source != naive_CD4_identifier & target != naive_CD4_identifier) %>%
dplyr::as_tibble() %>%
dplyr::group_by(source, target) %>%
dplyr::summarise(Tumor_Interactions = n())
## `summarise()` has grouped output by 'source'. You can override using the
## `.groups` argument.
df.s <- cellchat.s %>%
subsetCommunication(thresh = NA) %>%
dplyr::as_tibble() %>%
dplyr::group_by(source, target) %>%
dplyr::summarise(Skin_Interactions = n())
## `summarise()` has grouped output by 'source'. You can override using the
## `.groups` argument.
# Merge datasets by the 'source' and 'target'
combined_data.diff <- full_join(df.t, df.s, by = c("source", "target"))
# Replace NAs with 0
combined_data.diff$Tumor_Interactions[is.na(combined_data.diff$Tumor_Interactions)] <- 0
combined_data.diff$Skin_Interactions[is.na(combined_data.diff$Skin_Interactions)] <- 0
# Compute the difference for each source-target pair: skin - tumor
combined_data.diff$Interaction_Difference <- combined_data.diff$Tumor_Interactions - combined_data.diff$Skin_Interactions
# Filter to get the top 10 interactions by absolute difference
top_10_diff <- combined_data.diff %>%
dplyr::ungroup() %>% # Calculate differences without grouping by 'source'
dplyr::arrange(-abs(Interaction_Difference)) %>%
dplyr::slice_head(n = 10)
print(top_10_diff)
## # A tibble: 10 × 5
## source target Tumor_Interactions Skin_Interactions Interaction_Difference
## <fct> <fct> <dbl> <dbl> <dbl>
## 1 Fibroblas… Fibro… 88 47 41
## 2 Fibroblas… Fibro… 71 111 -40
## 3 Fibroblas… Endot… 59 21 38
## 4 Endothel_… Fibro… 80 43 37
## 5 Fibroblas… Monoc… 79 43 36
## 6 Fibroblas… Endot… 49 16 33
## 7 Fibroblas… Fibro… 73 42 31
## 8 Fibroblas… Endot… 53 23 30
## 9 Fibroblas… Fibro… 63 93 -30
## 10 Endothel Endot… 44 15 29
# paired t-test
result <- t.test(top_10_diff$Tumor_Interactions, top_10_diff$Skin_Interactions, paired=TRUE)
print(result)
##
## Paired t-test
##
## data: top_10_diff$Tumor_Interactions and top_10_diff$Skin_Interactions
## t = 2.1911, df = 9, p-value = 0.05615
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
## -0.6652445 41.6652445
## sample estimates:
## mean difference
## 20.5
###p-value = 0.004082 => statistically significant difference between "Tumor_Interactions" and "Skin_Interactions"
# Plot top 10 interactions with biggest differences
difference_plot <- ggplot(top_10_diff, aes(x = paste(source, target, sep = "-"), y = Interaction_Difference,fill = Interaction_Difference > 0)) +
geom_bar(stat = "identity", position = "dodge") +
scale_fill_manual(values = c("TRUE" = rgb(178/255, 24/255, 43/255), "FALSE" = rgb(33/255, 102/255, 172/255)),
labels = c("TRUE" = "Tumor", "FALSE" = "Skin")) +
theme_minimal() +
labs(title = "Top 10 Differences in Interactions (Tumor - Skin)", y = "Difference in Interactions", x = "Interaction (Source-target)") +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
print(difference_plot)
Function to process interactions between sorce and target celltypes
plot_interaction <- function(df, source_value, target_value) {
df_filtered <- df %>%
filter(source == source_value & target == target_value) %>%
slice_max(order_by = abs(prob.delta), n = 100) %>%
select(-c(pval.t, pval.s))
# Create a label from the source and target values
interaction_label <- paste(source_value, target_value, sep = " to ")
# Pivot and plot using the new label
df_filtered %>%
pivot_longer(cols = c("prob.s", "prob.t"), names_to = "variable", values_to = "value") %>%
ggplot(aes(x = interaction_name_2, y = value, fill = variable)) +
geom_col(position = "dodge") +
scale_fill_manual(values = c("prob.s" = rgb(33/255, 102/255, 172/255), "prob.t" = rgb(178/255, 24/255, 43/255))) +
labs(x = interaction_label, y = "Probability", fill = "Probability") +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5))
}
Plotting top 10 interactions based on abs(interactions difference)
plot_interaction(merged_data, "Fibroblast_32", "Fibroblast_32") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
plot_interaction(merged_data, "Fibroblast_36", "Fibroblast_36")+
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
plot_interaction(merged_data, "Fibroblast_32", "Endothel")+
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
plot_interaction(merged_data, "Endothel_vasc._31", "Fibroblast_32")+
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
plot_interaction(merged_data, "Fibroblast_32", "Monocyte")+
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
plot_interaction(merged_data, "Fibroblast_20", "Endothel")+
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
plot_interaction(merged_data, "Fibroblast_32", "Fibroblast_20")+
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
plot_interaction(merged_data, "Fibroblast_18", "Endothel")+
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
plot_interaction(merged_data, "Fibroblast_18", "Fibroblast_36")+
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
plot_interaction(merged_data, "Endothel", "Endothel")+
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
Sorting interactions in tumor based on pval and prob
# Identifying the top interactions based on the p-value (interactions with pval == 0)
# Group by interaction_name, then filter where pval in the group are 0
interactions_pval_zero.t <- cellchat.t.sC %>%
group_by(interaction_name) %>%
filter(pval == 0)
# Calculate the number of interactions to select for the top 1%
top_1_percent_count <- ceiling(nrow(interactions_pval_zero.t) * 0.01) # Use ceiling() to round up
# Create a new dataframe sorted by prob and select top 1%
interactions_sorted_prob.t <- interactions_pval_zero.t %>%
ungroup() %>% # Ungroup to ensure slice_max works as expected
slice_max(order_by = prob, n = top_1_percent_count)
# all interactions summarised, so each interaction = row
# 'source' and 'target' are discrete factors, and 'ligand' and 'receptor' are characters
ggplot(interactions_sorted_prob.t, aes(x = source, y = target, label = interaction_name)) +
geom_tile(aes(fill = interaction_name), colour = "white") +
labs(title = "Top 1% Interactions in Tumor", x = "Source", y = "Target", fill = "Interactions") +
theme_minimal() + #white background
theme(
axis.text.x = element_text(angle = 90, hjust = 1)
)
# Retrieve the full data for these top interactions
details_top_interactions_t <- cellchat.t.sC %>%
filter(interaction_name %in% interactions_sorted_prob.t$interaction_name)
# interactions are NOT summarised, so each interaction = multiple rows
# 'source' and 'target' are discrete factors, and 'ligand' and 'receptor' are characters
ggplot(details_top_interactions_t, aes(x = source, y = target, label = interaction_name)) +
geom_tile(aes(fill = interaction_name), colour = "white") +
labs(title = "Top 1% Interactions in Tumor", x = "Source", y = "Target", fill = "Interactions") +
theme_minimal() + #white background
theme(
axis.text.x = element_text(angle = 90, hjust = 1)
)
Sorting interactions in skin based on pval and prob
# Identifying the top interactions based on the p-value (interactions with pval == 0)
# Group by interaction_name, then filter where pval in the group are 0
interactions_pval_zero.s <- cellchat.s.sC %>%
group_by(interaction_name) %>%
filter(pval == 0)
# Calculate the number of interactions to select for the top 1%
top_1_percent_count <- ceiling(nrow(interactions_pval_zero.s) * 0.01) # Use ceiling to round up
# Create a new dataframe sorted by prob and select top 1%
interactions_sorted_prob.s <- interactions_pval_zero.s %>%
ungroup() %>% # Ungroup to ensure slice_max works as expected
slice_max(order_by = prob, n = top_1_percent_count)
# all interactions summarised, so each interaction = row
# 'source' and 'target' are discrete factors, and 'ligand' and 'receptor' are characters
ggplot(interactions_sorted_prob.s, aes(x = source, y = target, label = interaction_name)) +
geom_tile(aes(fill = interaction_name), colour = "white") +
labs(title = "Top 1% Interactions in Skin", x = "Source", y = "Target", fill = "Interactions") +
theme_minimal() + #white background
theme(
axis.text.x = element_text(angle = 90, hjust = 1)
)
# Retrieve the full data for these top interactions
details_top_interactions_s <- cellchat.s.sC %>%
filter(interaction_name %in% interactions_sorted_prob.s$interaction_name)
# interactions are NOT summarised, so each interaction = multiple rows
# 'source' and 'target' are discrete factors, and 'ligand' and 'receptor' are characters
ggplot(details_top_interactions_s, aes(x = source, y = target, label = interaction_name)) +
geom_tile(aes(fill = interaction_name), colour = "white") +
labs(title = "Top 1% Interactions in Skin", x = "Source", y = "Target", fill = "Interactions") +
theme_minimal() + #white background
theme(
axis.text.x = element_text(angle = 90, hjust = 1)
)
Top 100 Interactions with Biggest Difference in Probability Tumor
# Filtering by pval == 0 and abs(prob.delta)
merged_common_data <- merged_data %>%
filter(pval.t == 0 & pval.s == 0) %>%
mutate(
more_common_in = ifelse(prob.delta > 0, "Tumor", "Skin")
)%>%
slice_max(order_by = abs(prob.delta), n = 100)
# Plotting
ggplot(merged_common_data, aes(x = source, y = target)) +
geom_tile(aes(fill = more_common_in), colour = "white") +
geom_text(aes(label = interaction_name), size = 3, check_overlap = TRUE, vjust = "top") + # Add interaction names
scale_fill_manual(values = c("Tumor" = rgb(178/255, 24/255, 43/255), "Skin" = rgb(33/255, 102/255, 172/255))) + # Define custom colors for tumor and skin
labs(title = "Top 100 Interactions with Biggest Difference in Probability (Tumor vs. Skin)",
x = "Source", y = "Target", fill = "More Common In") +
theme_minimal() +
theme(
axis.text.x = element_text(angle = 90, hjust = 1),
strip.background = element_blank(),
strip.text = element_text(size = 12, face = "bold")
)
Interaction based on cell types
# Now, let's loop over these top 10 interactions and create the desired plots.
for (i in 1:nrow(top_10_diff)) {
current_source <- top_10_diff$source[i]
current_target <- top_10_diff$target[i]
# Filter the merged_data for the current pair.
current_data <- merged_data %>%
filter(source == current_source, target == current_target)
# Plot
p <- ggplot(current_data, aes(x = ligand, y = receptor, fill = prob.delta)) +
geom_tile() +
scale_fill_gradient2(low = rgb(33/255, 102/255, 172/255), high = rgb(178/255, 24/255, 43/255), mid = "grey", midpoint = 0,
limits = c(min(current_data$prob.delta, na.rm = TRUE),
max(current_data$prob.delta, na.rm = TRUE)),
name = "Prob Delta") +
labs(title = paste("Ligand-Receptor Interactions for", current_source, "to", current_target),
x = "Ligand", y = "Receptor") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5),
axis.text.y = element_text(hjust = 1))
print(p)
# Save the plot
file_name <- paste0("/Users/juliat/Desktop/bachelor/", current_source, "_to_", current_target, ".pdf")
ggsave(file_name, plot = p, width = 10, height = 10)
}
Violing plots
THBS.t <- plotGeneExpression(cellchat.t, signaling = c("THBS"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(THBS.t)
THBS.s <- plotGeneExpression(cellchat.s, signaling = c("THBS"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(THBS.s)
CDH.t <- plotGeneExpression(cellchat.t, signaling = c("CDH"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(CDH.t)
CDH.s <- plotGeneExpression(cellchat.s, signaling = c("CDH"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(CDH.s)
COLLAGEN.t <- plotGeneExpression(cellchat.t, signaling = c("COLLAGEN"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(COLLAGEN.t)
COLLAGEN.s <- plotGeneExpression(cellchat.s, signaling = c("COLLAGEN"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(COLLAGEN.s)
COMPLEMENT.t <- plotGeneExpression(cellchat.t, signaling = c("COMPLEMENT"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(COMPLEMENT.t)
COMPLEMENT.s <- plotGeneExpression(cellchat.s, signaling = c("COMPLEMENT"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(COMPLEMENT.s)
CXCL.t <- plotGeneExpression(cellchat.t, signaling = c("CXCL"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(CXCL.t)
CXCL.s <- plotGeneExpression(cellchat.s, signaling = c("CXCL"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(CXCL.s)
LAMININ.t <- plotGeneExpression(cellchat.t, signaling = c("LAMININ"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(LAMININ.t)
LAMININ.s <- plotGeneExpression(cellchat.s, signaling = c("LAMININ"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(LAMININ.s)
GALECTIN.t <- plotGeneExpression(cellchat.t, signaling = c("GALECTIN"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(GALECTIN.t)
GALECTIN.s <- plotGeneExpression(cellchat.s, signaling = c("GALECTIN"))
## There is no significant communication of GALECTIN
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(GALECTIN.s)
MIF.t <- plotGeneExpression(cellchat.t, signaling = c("MIF"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(MIF.t)
MIF.s <- plotGeneExpression(cellchat.s, signaling = c("MIF"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(MIF.s)
SEMA3.t <- plotGeneExpression(cellchat.t, signaling = c("SEMA3"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(SEMA3.t)
SEMA3.s <- plotGeneExpression(cellchat.s, signaling = c("SEMA3"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(SEMA3.s)
VISFATIN.t <- plotGeneExpression(cellchat.t, signaling = c("VISFATIN"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(VISFATIN.t)
VISFATIN.s <- plotGeneExpression(cellchat.s, signaling = c("VISFATIN"))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
plot(VISFATIN.s)